<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ModelNumberColor extends BaseModel
{
    use HasFactory;
    protected $table = 'model_number_color';
    // 允许批量操作的字段
    protected $fillable = ['model_number_id','semi_modelid','product_id','color_essential','color_shelf','color_match','color_id','created_at','updated_at'];

    public function color_essential(){
        return $this->hasOne(Color::class,'id','color_essential');
    }
    public function color_shelf(){
        return $this->hasOne(Color::class,'id','color_shelf');
    }
    public function color_match(){
        return $this->hasOne(Color::class,'id','color_match');
    }
    public function models(){
        return $this->hasOne(Models::class,'modelid','semi_modelid');
    }
    public function product(){
        return $this->hasOne(Product::class,'id','product_id');
    }
}
